{extend name='base'}
{block name='content'}



        <div id="masthead" >
            <div id="masthead-v5" style="width: 1200px;">
                <div class="ali-logo-v5">
                    <a class="main-logo-v5" href="" titinle="阿里巴巴">
                        <img width="108" height="38" src="__STATIC__/Home/imges/2331.png" alt="阿里巴巴">
                    </a>
                    <span class="sub-logo-v5">我的进货单</span>
                </div>
            </div>
        </div>

    <div id="content">
        <div class="layer">
            <div class="mod-start clearfix">
                <span>进货单状态：</span>
	    <span class="unit-progress-bar unit-status-bar">
	      <span class="bar">
	        <span class="sub" style="overflow: hidden; width: 1.14px;"></span>
	      </span>
	      <span class="sum">1/100</span>
	    </span>
            </div>
            <div class="mod-switch">
                <ul class="clearfix">
                    <li class="active"><a>我的进货单</a></li>
                    <li class="expand"><a>我的淘货源</a></li>
                </ul>
            </div>
            <!--<form action="{:url('index/Order/index')}" method="post">-->
            <div class="car main">
                <div class="carshop">
                    <div class="cartitle">
                        <div class="carcheck">
                            <div class="checkbox" id="all">
                                   <input type="checkbox" name='checkbox' class="checkhide"/>
                            </div>全选</div>
                        <div class="carname">商品名称</div>
                        <div class="carmoney">单价</div>
                        <div class="carnum">数量</div>
                        <div class="carcount">小计</div>
                        <div class="carhandle">操作</div>
                    </div>
<script>
    $(function(){
        $('#all input.checkhide').click(function(){
            if(this.checked){
                $(".list :checkbox").prop("checked", true);
            }else{
                $(".list :checkbox").prop("checked", false);
            }
        });
        $(".list :checkbox").change(function(){
            if($('.list :checkbox').not("input:checked").size() <= 0){
                //如果其它的复选框全部被勾选了，那么全选勾中
                $('#all input').prop('checked',true);
            }else{
                $('#all input').prop('checked',false);
            }
        });

    })
</script>
                    {foreach name="cart['goods']" item='v' key='k'}
                    <div class="shopcontent"  kk="{$k}">
                        <div class="shopcheck">
                            <div class="checkbox list" >
                                <input type="checkbox" name='checkbox' class="checkhide" />
                            </div>
                        </div>
                        <div class="shopname">
                            <div class="carimg">
                                <a href=""><img src="{$v['pic']}"/></a>
                            </div>
                            <p>
                                <a href="#">{$v['name']}</a>
                                <span>{$v['options']}</span>
                            </p>
                        </div>
                        <div class="shopmoney">{$v['price']}元</div>
                        <div class="shopnum">
                            <a href="javascript:;" class="num_l">-</a>
                            <input type="text" value="{$v['num']}" class="number"/>
                            <a href="javascript:;" class="num_r">+</a>
                        </div>
                        <div class="shopcount">{$v['total']}元</div>
                        <div class="shophandle" kk="{$k}"><span>删除</span></div>
                    </div>
{/foreach}
                </div>

                <!--********增加数量********-->
                <script>
                    $(function () {
                        $('.num_l').click(function () {
                            //1.获得数量
                            var num = $(this).siblings('.number').val();
                            //2.抓键名
                            var kk = $(this).parents('.shopcontent').attr('kk');
                            var _this = $(this);
                            $.ajax({
                                type:'post',
                                url:"{:url('updateCart')}",
                                data:{num:num,kk:kk},
                                dataType:'json',
                                success:function (res) {
                                    _this.find('.shopcount').text(res.total);
                                    $('.gongji span').text(res.total_price);
                                }
                            })
                        })
                    })
                </script>
                <!--********增加数量结束********-->
                <!--********减少数量********-->
                <script>
                    $(function () {
                        $('.num_r').click(function () {
                            //1.获得数量
                            var num = $(this).siblings('.number').val();
                            //2.抓键名
                            var kk = $(this).parents('.shopcontent').attr('kk');
                            var _this = $(this);
                            $.ajax({
                                type:'post',
                                url:"{:url('updateCart')}",
                                data:{num:num,kk:kk},
                                dataType:'json',
                                success:function (res) {
                                    _this.find('.shopcount').text(res.total);
                                    $('.gongji span').text(res.total_price);
                                }
                            })
                        })
                    })
                </script>
                <!--********减少数量结束********-->
                <!--********删除********-->
                <script>
                    $(function () {
                        $('.shophandle span').click(function () {
                            //2.抓键名
                            var kk = $(this).parents('.shophandle').attr('kk');
                            var _this = $(this);
                            $.ajax({
                                type:'post',
                                url:"{:url('updateCart')}",
                                data:{kk:kk},
                                dataType:'json',
                                success:function (res) {
                                    _this.find('.shopcount').text(res.total);
                                    $('.gongji span').text(res.total_rows);
                                }
                            })
                        })
                    })
                </script>
                <!--********删除********-->
                <div class="jiesuan">
                    <div class="jixu"><a href="">继续购物</a></div>
                    <div class="gongji">共计<span>{$cart['total_rows']}</span>件商品</div>
                    <div class="heji">合计<span>{$cart['total_price']}</span></div>
                    <div class="gou">
                        <span>
                            <input  id="getValue"  type="submit" value="去结算"/>
                        </span>
                    </div>
                    <script>
                        $(function () {
                            $('.gou ').click(function () {
                                var kk="";
                                var num=0;
                                var price = 0;
                                $(".shopcontent").each(function(){
                                    if($(this).find($(".list :checkbox")).prop("checked")==true){
                                        kk += $(this).attr('kk')+",";
                                         num += parseInt($(this).find('.number').val());
                                        price += parseInt($(this).find('.shopcount').text());
                                        kid=kk.substring(0,kk.length-1);
                                    }
                                });


                                $.ajax({
                                    type:'post',
                                    url:"{:url('submit')}",
                                    data:{kid:kid,num:num,price:price},
                                    dataType:'json',
                                    success:function (res) {
                                        location.href = "{:url('index/Order/index')}"
                                    }
                                })
                            })

                            })
                    </script>
                </div>
            </div>
            <!--</form>-->
        </div>
    </div>
    <div id="footer-v0">
        <div class="footer-container">
            <div class="ali-pages">
                <ul style="display: inline-block;">
                    <li>© 2010-2017 1688.com 版权所有|</li>
                    <li><a rel="nofollow" href="" target="_self" title="著作权与商标声明">著作权与商标声明</a> |</li>
                    <li><a rel="nofollow" href="" target="_self" title="法律声明">法律声明</a> |</li>
                    <li><a rel="nofollow" href="" target="_self" title="服务条款">服务条款</a> |</li>
                    <li><a rel="nofollow" href="" target="_self" title="隐私政策">隐私政策</a> |</li>
                    <li><a rel="nofollow" href="" target="_self" title="关于阿里巴巴">关于阿里巴巴</a> |</li>
                    <li><a rel="nofollow" href="" target="_self" title="联系我们">联系我们</a> |</li>
                    <li><a href="" target="_self" title="网站导航">网站导航</a></li>
                </ul>
            </div>
            <div class="ali-group" style="display: inline-block;">
                <dl style="display: inline-block;">
                    <dd>
                        <a rel="nofollow" href="" title="阿里巴巴集团">阿里巴巴集团</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="阿里巴巴国际站">阿里巴巴国际站</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="阿里巴巴中国站">阿里巴巴中国站</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="全球速卖通">全球速卖通</a>
                        |
                    </dd>

                    <dd>
                        <a rel="nofollow" href="" title="淘宝网">淘宝网</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="天猫">天猫</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="聚划算">聚划算</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="一淘">一淘</a>
                        |
                    </dd>
                    <dd>
                        <a href="" title="阿里旅行 · 去啊">阿里旅行 · 去啊</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="阿里妈妈">阿里妈妈</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="虾米">虾米</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="阿里云计算">阿里云计算</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="YunOS">YunOS</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="阿里通信">阿里通信</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="万网">万网</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href=" " title="">UC</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="支付宝">支付宝</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="来往">来往</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="钉钉">钉钉</a>
                        |
                    </dd>
                    <dd>
                        <a rel="nofollow" href="" title="阿里健康">阿里健康</a>
                        |
                    </dd>
                    <dd>
                        <a href="" title="一达通">一达通</a>
                        |
                    </dd>
                    <dd>
                        <a href="" title="Lazada">Lazada</a>
                    </dd>
                </dl>
            </div>
        </div>
    </div>
{/block}